package com.youkeda.test.j3.c9;

import com.youkeda.test.j3.c9.model.Weather;

/**
 * 调用天气API -> 读取天气数据 -> 数据反序列化为对象 -> 发送邮件带上数据
 *
 * @author CoderXshuai
 */
public class WeatherNotice {
    public static void main(String[] args) {
        WeatherPicker picker = new WeatherPicker();
        Mail mail = new Mail();
        String username = "1464978594@qq.com";
        String password = "dzbguwqynvdngfgi";
        String address = "18603761952@163.com";
        String subject = "天气推送";
        String content = "";
        String pickerContent = picker.getContent("http://www.weather.com.cn/data/sk/101040200.html");
        Weather weather = picker.getWeather(pickerContent);
        content = "<p style=\"color: \">"+"city:" + weather.getWeatherInfo().getCity() + "<br>"+"temp=" + weather.getWeatherInfo().getTemp()+"</p>";
        mail.initMail(username, password, address, subject, content);
    }
}
